package fluo.centralserver;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

import fluo.androidclient.FluoMessage;

public class CSTest {
	public static void main(String args[]) throws UnknownHostException, IOException, ClassNotFoundException{
		Socket sock = new Socket(InetAddress.getByName(CentralServerDetails.ip), 42425);

		ObjectOutputStream oos = new ObjectOutputStream(sock.getOutputStream());
		ObjectInputStream ois = new ObjectInputStream(sock.getInputStream());
		
		FluoMessage fm = new FluoMessage("maherbeg", "password", false);
		//oos.writeChars("android\n");
		oos.writeObject(new String("android"));
		/*oos.writeObject(fm);
		
		while(ois.available() == 0);
		String x = "";
		while(ois.available() != 0) x+= ois.readChar();
		System.out.println(x);*/
		FluoMessage ret = (FluoMessage)ois.readObject();
		
		System.out.println(ret.getDSList());
		sock.close();
		
	}
}
